import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router);

// 生成路由
export default new Router({
  routes: [{
    path: '/',
    redirect: '/blog',
  }, {
    path: '/blog',
    name: 'blog',
    // meta: { title: '首页', icon: 'example' },
    component: () => import('@/views/blog/index'),
    children: [{
      path: '',
      name: 'articleList',
      component: () => import('@/views/article/list')
    }, {
      path: 'article/:id',
      name: 'article',
      component: () => import('@/views/article/detail')
    }]
  }, {
    path: '/admin',
    component: () => import('@/views/admin/index'),
    children: [{
      path: 'article/list',
      name: 'adminArticeList',
      component: () => import('@/views/admin/articleList'),
    }, {
      path: 'article/new',
      name: 'adminArticeNew',
      component: () => import('@/views/admin/publishArticle'),
    }, {
      path: 'article/:id',
      name: 'adminArticeEdit',
      component: () => import('@/views/admin/publishArticle'),
    }]
  }
  ]
})
